//
//  AlbumDetaiHeadView.m
//  PSYWeiBo
//
//  Created by xiaotian on 16/3/16.
//  Copyright © 2016年 郑亚田. All rights reserved.
//

#import "AlbumDetaiHeadView.h"

@implementation AlbumDetaiHeadView

- (instancetype)init {
    self = [super init];
    if (self) {
        [self addAllViews];
    }
    
    return self;
}

- (void)addAllViews {
    self.backgroundColor = [UIColor whiteColor];
    
    self.bgrImg = [UIImageView new];
    [self addSubview:self.bgrImg];
    [self.bgrImg mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.equalTo(self).with.insets(UIEdgeInsetsMake(0, 0, 0, 0));
        make.left.bottom.right.equalTo(@0);
        make.height.equalTo(@44);
    }];
    self.bgrImg.image = [UIImage imageNamed:@"dw_header_time"];
    
    self.coverBgrImg = [UIImageView new];
    [self addSubview:self.coverBgrImg];
    [self.coverBgrImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@15);
        make.width.height.equalTo(@(kScreenWidth * 0.4 - 20));
    }];
    self.coverBgrImg.image = [UIImage imageNamed:@"addAlbumFive"];
    
    self.coverImg = [UIImageView new];
    [self.coverBgrImg addSubview:self.coverImg];
    [self.coverImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.coverBgrImg).with.insets(UIEdgeInsetsMake(8, 8, 8, 8));
    }];
    self.coverImg.image = [UIImage imageNamed:@"custom-menu-photo"];
    
    self.albumName = [UILabel new];
    [self addSubview:self.albumName];
    [self.albumName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.coverBgrImg.mas_right).with.offset(15);
        make.top.mas_equalTo(self.coverBgrImg.mas_top);
        make.right.equalTo(@-10);
        make.height.equalTo(@20);
    }];
    self.albumName.text = @"test";
    
    self.albumDesc = [UILabel new];
    [self addSubview:self.albumDesc];
    [self.albumDesc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.albumName.mas_bottom);
        make.leading.mas_equalTo(self.albumName.mas_leading);
        make.trailing.mas_equalTo(self.albumName.mas_trailing);
        make.bottom.mas_equalTo(self.coverBgrImg.mas_bottom);
    }];
    self.albumDesc.text = @"暂无简介";
    
    self.addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:self.addBtn];
    [self.addBtn setBackgroundImage:[UIImage imageNamed:@"addPhotoBtn"] forState:UIControlStateNormal];
    [self.addBtn setImage:[UIImage imageNamed:@"addPhotoIcon"] forState:UIControlStateNormal];
    
    self.playBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:self.playBtn];
    [self.playBtn setBackgroundImage:[UIImage imageNamed:@"playAlbumBtn"] forState:UIControlStateNormal];
    [self.playBtn setImage:[UIImage imageNamed:@"playAlbumIcon"] forState:UIControlStateNormal];
    
    [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.coverBgrImg.mas_bottom).with.offset(15);
        make.left.equalTo(self.mas_left).with.offset(15);
        make.right.equalTo(self.playBtn.mas_left).with.offset(-2);
        make.height.mas_equalTo(@25);
        make.width.equalTo(self.playBtn);
    }];
    [self.playBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.addBtn.mas_centerY);
        make.left.equalTo(self.addBtn.mas_right).with.offset(2);
        make.right.equalTo(self.mas_right).with.offset(-15);
        make.height.mas_equalTo(@25);
        make.width.equalTo(self.addBtn);
    }];
}

@end
